home *** CD-ROM | disk | FTP | other *** search
/ Professional Soft Collection 1.02 / Professional Soft Collection 1.02.iso / winutils / wingauge.zip / INTEGR4.C < prev    next >
C/C++ Source or Header  |  1993-01-19  |  2KB  |  59 lines

  1. #pragma option -zC_ABOUT
  2.  
  3. #pragma hdrfile "WinGauge.SYM"
  4. #include <win31.h>
  5. #include "wingauge.h"
  6. #include "wingauge.rh"
  7. #pragma hdrstop
  8.  
  9.  
  10. BOOL FAR PASCAL AboutDlgProc( HWND hDlg, WORD iMessage, WORD wParam,
  11.                             LONG lParam )
  12. { static HBRUSH    hBrush;
  13.   static HICON    hIcon;
  14.   static HWND    hDlgIcon;
  15.   PAINTSTRUCT    ps;
  16.   POINT        point;
  17.   char        cBuffer[80];
  18.   HDC        hDC;
  19.  
  20.   switch( iMessage )
  21.     { case WM_INITDIALOG:
  22.                     // Prepare brush for dialog background
  23.       hBrush = CreateSolidBrush( LIGHTGRAY );
  24.                     // Prepare icon for dialog box
  25.       hIcon  = LoadIcon( hInst, MAKEINTRESOURCE( LOWORD(lParam)+1 ) );
  26.                     // Get icon template window handle
  27.       hDlgIcon = GetDlgItem( hDlg, IDD_ICON );
  28.                     // Set panel name (or NULL) in dialog
  29.       LoadString( hInst, LOWORD(lParam)+1, cBuffer, sizeof(cBuffer) );
  30.       SetDlgItemText( hDlg, IDD_NAME, cBuffer );
  31.       return TRUE;            // Set focus to OK button
  32.  
  33.       case WM_CTLCOLOR:                 // Select color for background paint
  34.       SetBkColor( wParam, LIGHTGRAY );
  35.       UnrealizeObject( hBrush );
  36.       point.x = point.y = 0;
  37.       ClientToScreen( hDlg, &point );
  38.       SetBrushOrg( wParam, point.x, point.y );
  39.       return hBrush;
  40.  
  41.       case WM_PAINT:
  42.       BeginPaint( hDlg, &ps );
  43.       EndPaint( hDlg, &ps );
  44.       hDC = GetDC( hDlgIcon );
  45.       DrawIcon( hDC, 0, 0, hIcon );    // Draw icon for current panel
  46.       ReleaseDC( hDlgIcon, hDC );
  47.       ValidateRect( hDlgIcon, NULL );
  48.       return TRUE;
  49.  
  50.       case WM_COMMAND:
  51.       if( wParam == IDOK || wParam == IDCANCEL )
  52.         { EndDialog( hDlg, 0 );
  53.           DeleteObject( hBrush );        // Clearance!
  54.           FreeResource( hIcon );
  55.           return TRUE;
  56.         }
  57.     }
  58.   return FALSE;
  59. }